<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Connect to the specified database</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ovrimos-commit.html">ovrimos_commit</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ovrimos-cursor.html">ovrimos_cursor</a></div>
 <div class="up"><a href="ref.ovrimos.html">Ovrimos SQL 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.ovrimos-connect" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ovrimos_connect</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.3, PHP 5 &lt;= 5.0.5)</p><p class="refpurpose"><span class="refname">ovrimos_connect</span> &mdash; <span class="dc-title">Connect to the specified database</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ovrimos-connect-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>ovrimos_connect</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$host</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$dborport</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$user</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$password</code></span>
   )</div>

  <p class="para rdfs-comment">
   Connects to the specified database.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ovrimos-connect-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">host</code></em></dt>

     <dd>

      <p class="para">
       A host name or IP address.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">dborport</code></em></dt>

     <dd>

      <p class="para">
       Either a database name, or the port number to connect to.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">user</code></em></dt>

     <dd>

      <p class="para">
       The user name.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">password</code></em></dt>

     <dd>

      <p class="para">
       Password associated with <em><code class="parameter">user</code></em>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ovrimos-connect-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a connection identifier (greater than 0) on success, or 0 on
   failure.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ovrimos-connect-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2001">
    <p><strong>Example #1 <span class="function"><strong>ovrimos_connect()</strong></span> Example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ovrimos_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"server.example.com"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"8001"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"admin"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Connection&nbsp;ok!"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$res&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ovrimos_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"select&nbsp;table_id,&nbsp;table_name&nbsp;from&nbsp;sys.tables"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$res&nbsp;</span><span style="color: #007700">!=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Statement&nbsp;ok!"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ovrimos_result_all</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ovrimos_free_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ovrimos_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ovrimos-connect-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.ovrimos-close.html" class="function" rel="rdfs-seeAlso">ovrimos_close()</a> - Closes the connection to ovrimos</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.ovrimos-commit.html">ovrimos_commit</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.ovrimos-cursor.html">ovrimos_cursor</a></div>
 <div class="up"><a href="ref.ovrimos.html">Ovrimos SQL 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
